home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 3 / CU Amiga Magazine's Super CD-ROM 03 (1996)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1996-09].iso / misc / gcc / gnu / libauto / baselocale.c < prev    next >
C/C++ Source or Header  |  1994-06-16  |  1KB  |  42 lines

  1. /* call this with the following defines (for example):
  2.    
  3.    LIBRARY_NAME        "intuition.library"
  4.    LIBRARY_BASE     IntuitionBase
  5.    LIBRARY_VERS     __auto_intui_vers
  6.  
  7.  */
  8.  
  9. #include <exec/types.h>
  10. #include <inline/exec.h>
  11.  
  12. #include <unistd.h>
  13. #include <stdlib.h>
  14. #include <string.h>
  15. #include <stdio.h>
  16.  
  17. struct LocaleBase * LIBRARY_BASE = 0;
  18. extern int LIBRARY_VERS;
  19.  
  20. #define STRING(a) a, sizeof (a) - 1
  21.  
  22. static void
  23. constructor ()
  24. {
  25.   /* Since this is for locale.library, we must not exit if locale.library
  26.      not exists since then we will use builtin strings
  27.   */
  28.   LIBRARY_BASE = (struct LocaleBase* )OpenLibrary (LIBRARY_NAME, LIBRARY_VERS);
  29. }
  30.  
  31. static void
  32. destructor ()
  33. {  /* There is no need to check if LIBRARY_BASE is NULL, since
  34.       CloseLibrary deals with NULL from V36 and locale is for V38+
  35.    */
  36.    CloseLibrary ((struct Library* )LIBRARY_BASE);
  37.    LIBRARY_BASE = 0;
  38. }
  39.  
  40. asm ("    .text;     .stabs \"___CTOR_LIST__\",22,0,0,_constructor");
  41. asm ("    .text;     .stabs \"___DTOR_LIST__\",22,0,0,_destructor");
  42.